<template>
  <div>
    <UserQuery @on-reset="queryReset" @on-submit="querySubmit" />
    <UserContent ref="userContentRef" @on-add="contentAdd" @on-edit="contentEdit" />
    <UserDrawer ref="userDrawerRef" />
  </div>
</template>

<script lang="ts" setup>
import UserQuery from './conponents/user-query.vue';
import UserContent from './conponents/user-content.vue';
import UserDrawer from './conponents/user-drawer.vue';
import { ref } from "vue";
import useCommonStore from "@/store/common"

var commonStore = useCommonStore()
var userContentRef = ref<InstanceType<typeof UserContent>>()
var userDrawerRef = ref<InstanceType<typeof UserDrawer>>()

commonStore.getRolesAction()
commonStore.getDepartmentsAction()

// 查询
function querySubmit(queryFormModel: any) {
  userContentRef.value?.getTableData(queryFormModel)
}
// 查询重置
function queryReset(queryFormModel: any) {
  userContentRef.value?.getTableData(queryFormModel)
}
// 点击添加
function contentAdd() {
  userDrawerRef.value?.open()
}
// 点击编辑
function contentEdit(row) {
  userDrawerRef.value?.open(row)
}
</script>

<style lang="scss" scoped></style>
